<template>
  <div class="xiazai">
    <img
      class="bgs"
      @click="opp"
      src="https://o6wndwjxn.qnssl.com/down.png"
    >
    <img
      v-if="showios"
      class="show-ios"
      src="https://o6wndwjxn.qnssl.com/%E7%BC%96%E7%BB%84%205@2x.png"
    >
  </div>
</template>

<script>
let isWechat = /micromessenger/i.test(navigator.userAgent)
let isWeibo = /weibo/i.test(navigator.userAgent)
let isQQ = /qq\//i.test(navigator.userAgent)
let isIOS = /(iphone|ipod|ipad|ios)/i.test(navigator.userAgent)
let isAndroid = /android/i.test(navigator.userAgent)
export default {
  created () {
    console.log(this.$route.query)
    if (this.$route.query.has && isWechat === true && isIOS) {
      this.showios = true
    }
    if (this.$route.query.has && isWechat === false && isIOS) {
      window.location.href = `zhiyun://`
      // window.location.href = `ZTW://lessiondetail/${this.$route.query.type}/${this.$route.query.curriculum_id}/${this.$route.query.chapter_id}`
    }
    this.$store.commit('updateLoadingStatus', { isLoading: false })
  },
  data () {
    return {
      showios: false
    }
  },
  methods: {
    opp () {
      if (window.__wxjs_is_wkwebview !== true) {
        window.location.href = 'https://a.app.qq.com/o/simple.jsp?pkgname=com.zhongtian.zhiyun'
      } else {
        window.location.href = 'https://itunes.apple.com/cn/app/%E7%9F%A5%E8%BF%90/id1462867435?mt=8'
      }
      if (isAndroid === true) {
        window.location.href = 'https://a.app.qq.com/o/simple.jsp?pkgname=com.zhongtian.zhiyun'
      } else {
        window.location.href = 'https://itunes.apple.com/cn/app/%E7%9F%A5%E8%BF%90/id1462867435?mt=8'
      }
    }
  }
}
</script>

<style>
.xiazai {
  width: 100%;
  height: 100vh;
  background-image: url("https://o6wndwjxn.qnssl.com/%E8%83%8C%E6%99%AF.png");
  background-repeat: no-repeat;
  background-size: cover;
  position: relative;
}
.xiazai .bgs {
  top: 5vh;
  width: 95%;
  left: 50%;
  transform: translate(-50%, 0);
  position: fixed;
}
.show-ios {
  width: 50%;
  position: absolute;
  right: 5px;
  top: 4px;
}
</style>
